Add MCP gateway auto-discovery integrations for chat clients and agents#2
Add MCP gateway auto-discovery integrations for chat clients and agents#2KSemenenko wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 071b700148
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/ManagedCode.MCPGateway/McpGatewayAutoDiscoveryChatClient.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR adds staged MCP gateway auto-discovery for chat clients and agents. It introduces McpGatewayAutoDiscoveryChatClient (and its UseManagedCodeMcpGatewayAutoDiscovery extension), the CreateDiscoveredTools/AddTools additions to McpGatewayToolSet, and integration tests covering both direct IChatClient and Microsoft Agent Framework scenarios against a 50-tool catalog in lexical and vector modes. It also rewrites the README as consumer-facing onboarding and adds a new ADR.
Changes:
- New
McpGatewayAutoDiscoveryChatClientandUseManagedCodeMcpGatewayAutoDiscoverywrapper for staged per-turn tool exposure in chat loops - Extended
McpGatewayToolSetwithCreateDiscoveredTools/AddToolsand newChatOptions.AddMcpGatewayToolsextension;AddManagedCodeMcpGatewayToolsmarked obsolete - Integration tests (
McpGatewayChatClientIntegrationTests,McpGatewayAgentFrameworkIntegrationTests) and enriched test helpers (TestChatClientwith scenario support,GatewayIntegrationTestSupport); README/ADR/docs updated
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/ManagedCode.MCPGateway/McpGatewayAutoDiscoveryChatClient.cs |
New: per-request staged tool-discovery chat client wrapper |
src/ManagedCode.MCPGateway/McpGatewayToolSet.cs |
Extended: AddTools, CreateDiscoveredTools, proxy-tool creation |
src/ManagedCode.MCPGateway/Registration/McpGatewayChatOptionsExtensions.cs |
New: AddMcpGatewayTools + obsolete shims |
src/ManagedCode.MCPGateway/Registration/McpGatewayChatClientExtensions.cs |
New: UseManagedCodeMcpGatewayAutoDiscovery extension |
src/ManagedCode.MCPGateway/Configuration/McpGatewayAutoDiscoveryOptions.cs |
New: options for max tools, tool names |
src/ManagedCode.MCPGateway/Internal/Serialization/McpGatewayJsonSerializer.cs |
Added JsonStringEnumConverter to serializer options |
tests/ManagedCode.MCPGateway.Tests/ChatClient/McpGatewayChatClientIntegrationTests.cs |
New: integration tests for direct IChatClient auto-discovery |
tests/ManagedCode.MCPGateway.Tests/Agents/McpGatewayAgentFrameworkIntegrationTests.cs |
New: integration tests for Agent Framework auto-discovery |
tests/ManagedCode.MCPGateway.Tests/TestSupport/TestChatClient.cs |
Extended: scenario-driven invocation capture |
tests/ManagedCode.MCPGateway.Tests/TestSupport/GatewayIntegrationTestSupport.cs |
New: 50-tool catalog + scenario builders + flow assertions |
tests/ManagedCode.MCPGateway.Tests/TestSupport/TestEmbeddingGenerator.cs |
New CreateVector hook for semantic vector tests |
tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj |
Added Microsoft.Agents.AI package reference |
Directory.Packages.props |
Added Microsoft.Agents.AI 1.0.0-rc3; bumped ModelContextProtocol to 1.1.0 and TUnit to 1.19.0 |
docs/ADR/ADR-0003-reusable-chat-client-and-agent-tool-modules.md |
New ADR documenting the AITool-module approach |
docs/Architecture/Overview.md |
Updated architecture diagrams and module map |
README.md |
Rewritten as consumer-facing onboarding |
AGENTS.md |
New coding rules added |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/ManagedCode.MCPGateway.Tests/TestSupport/GatewayIntegrationTestSupport.cs
Outdated
Show resolved
Hide resolved
src/ManagedCode.MCPGateway/Registration/McpGatewayChatClientExtensions.cs
Outdated
Show resolved
Hide resolved
|
Addressed all open review comments in Covered fixes:
Verification:
|
|
#3 contains all implemention |
Summary
McpGatewayAutoDiscoveryChatClientandUseManagedCodeMcpGatewayAutoDiscovery(...)wrapper for staged tool exposure in chat loopsMcpGatewayToolSetwith discovered proxy-tool creation and add the shorterAddMcpGatewayTools(...)chat-options APIIChatClientand Microsoft Agent Framework flows against a 50-tool catalog in both lexical fallback mode and vector modeTesting
dotnet restore ManagedCode.MCPGateway.slnxdotnet build ManagedCode.MCPGateway.slnx -c Release --no-restoredotnet build ManagedCode.MCPGateway.slnx -c Release --no-restore -p:RunAnalyzers=truedotnet test --solution ManagedCode.MCPGateway.slnx -c Release --no-buildcloc src testsroslynator analyze src/ManagedCode.MCPGateway/ManagedCode.MCPGateway.csproj tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj --severity-level warning